import java.util.Arrays;

/**
 * @author: li_jian
 * @version: 1.0
 * @date: 2020/7/7 22:35
 * @description： @link{https://www.nowcoder.com/practice/22243d016f6b47f2a6928b4313c85387?tpId=13&&tqId=11162&rp=1&ru=/ta/coding-interviews&qru=/ta/coding-interviews/question-ranking}
 */
public class JZ9_变态跳台阶 {

    /**
     * 动态规划实现
     * @param target
     * @return
     */
    public int JumpFloorII(int target) {
        int[] dp = new int[target];
        Arrays.fill(dp, 1);
        for (int i = 1; i < target; i++) {
            for (int j = 0; j < i; j++) {
                dp[i] +=dp[j];
            }
        }
        return dp[target-1];
    }

    /**
     * 使用等比数列实现
     * @param target
     * @return
     */
    public static int JumpFloorII_2(int target){
        return (int) Math.pow(2, target-1);
    }

    public static void main(String[] args) {
        System.out.println(JumpFloorII_2(3));;
    }
}
